/*
Assignment 1
构建NpuInfo类，该类中三个成员变量：
name：”西北工业大学”
address：” 西安市友谊西路127号”
telephone：”029-88494433”
在系统中均不会发生变化，请采用单例模式构建该类。
 */

package demo2.assignment1;

public class NpuInfo {

    private final String name;
    private final String address;
    private final String telephone;

    private static NpuInfo npuInfo;

    private NpuInfo() {
        this("西北工业大学", "西安市友谊西路127号", "029-88494433");
    }

    public NpuInfo(String name, String address, String telephone) {
        this.name = name;
        this.address = address;
        this.telephone = telephone;
    }

    public static NpuInfo getInstance() {
        if (npuInfo == null) {
            synchronized (NpuInfo.class) {
                if (npuInfo == null)
                    npuInfo = new NpuInfo();
            }
        }
        return npuInfo;
    }
}
